#ifndef NR_CLIENT_COMMUNICATION_H
#define NR_CLIENT_COMMUNICATION_H


#include <nr_net_client.h>
#include <QObject>


//get DeviceTree from Server by this class

class client_Communication : 
    public QObject,
    public nr_net_reply_delegate,
    public nr_net_client_data_delegate
{
	Q_OBJECT

public:
    client_Communication(QObject *parent);
    virtual ~client_Communication(void);

    void run();

    void login();

    void get_items();

    nr_device_item_server& get_device_item_server(){return *n_device_item_server;}

    virtual void on_error(nr_error_t error);

    virtual void on_reply(nr_object &reply);

    virtual nr_error_t on_receive_data(nr_data *data);

    virtual nr_error_t on_receive_event(nr_event *evt);

    void start_GetdataFromServer(QList<nr_device_id_t> device_id_list);

	void start_QuerydataFromServer(const nr_device_id_t& device_id, QDateTime &begin_time, QDateTime &end_time );

signals:
	void client_received_deviceitem_fromserver(nr_device_item_server& device_item_server);
	void client_received_data (nr_data *data);
	void client_received_hisdata(QList<nr_data*>& data_list);

private:
    nr_net_client m_client;
    nr_device_item_server* n_device_item_server;
	nr_data* m_data;
	//QList<nr_data*>* m_data_list;
	//subwindow1 m_DA;

};

#endif